package com.yhf.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yhf.dto.ProjectOv;
import com.yhf.dto.StagePto;
import com.yhf.model.Stage;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

@Mapper
public interface StageMapper extends BaseMapper<Stage> {

    @Results(id = "stagepto",value = {
            @Result(column = "sid",property = "sid"),
            @Result(column = "sname",property = "sname"),
            @Result(column = "starttime",property = "starttime"),
            @Result(column = "endtime",property = "endtime"),
            @Result(column = "updatetime",property = "updatetime"),
            @Result(column = "status",property = "status"),
            @Result(column = "pid",property = "projectOv",javaType = ProjectOv.class,one =
            @One(select = "com.yhf.mapper.PMapper.selectByPid",fetchType = FetchType.EAGER))
    })
    @Select("select * from stage ${ew.customSqlSegment}")
    IPage<StagePto> selectAll(Page<StagePto> page,@Param(Constants.WRAPPER) QueryWrapper<StagePto> queryWrapper);
}
